package org.infodavid.common.model;

import java.util.Map;

import org.infodavid.common.persistence.IDataObject;
import org.infodavid.common.persistence.ILockable;
import org.joda.time.DateTime;

/**
 * The Interface IUserSession.
 */
public interface IUserSession extends IDataObject<String>, ILockable {
  /** The AUTH_SOURCE. */
  String AUTH_SOURCE = "authenticationSource";

  /** The AUTH_SERVER. */
  String AUTH_SERVER = "authenticationServer";

  /** The SIGNED_OUT. */
  String SIGNED_OUT = "signedOut";

  /** The PROPERTIES. */
  String PROPERTIES = "properties";

  /** The ACCESSES_COUNT. */
  String ACCESSES_COUNT = "accessesCount";

  /** The ID. */
  String ID = "sessionKey";

  /** The LAST_ACCESS_DATE. */
  String LAST_ACCESS_DATE = "lastAccessDate";

  /** The LAST_IP. */
  String LAST_IP = IUser.LAST_IP;

  /** The LOGIN_NAME. */
  String LOGIN_NAME = "loginName";

  /** The constant MAX_LENGTH_LAST_IP. */
  int MAX_LENGTH_LAST_IP = 15;

  /** The USER. */
  String USER = IUser.USER;

  /** The USER_SESSION. */
  String USER_SESSION = "userSession";

  /**
   * Gets the authentication source.
   * @return the authentication source
   */
  String getAuthenticationSource();

  /**
   * Sets the authentication source.
   * @param value the new authentication source
   */
  void setAuthenticationSource(String value);

  /**
   * Gets the authentication server.
   * @return the authentication server
   */
  String getAuthenticationServer();

  /**
   * Sets the authentication server.
   * @param value the new authentication server
   */
  void setAuthenticationServer(String value);

  /**
   * Checks if is signed out.
   * @return true, if is signed out
   */
  boolean isSignedOut();

  /**
   * Sets the signed out.
   * @param value the new signed out
   */
  void setSignedOut(boolean value);

  /**
   * Gets the properties.
   * @return the parameters
   */
  Map<String,String> getProperties();

  /**
   * Gets this session access count.
   * @return the access count
   */
  long getAccessesCount();

  /**
   * Gets the last access date.
   * @return the last access date
   */
  DateTime getLastAccessDate();

  /**
   * Gets the last IP address.
   * @return the last address
   */
  String getLastIP();

  /**
   * Gets the login name.
   * @return the login name
   */
  String getLoginName();

  /**
   * Gets the user.
   * @return the user
   */
  IUser getUser();

  /**
   * Sets this session access count.
   * @param value the new access count
   */
  void setAccessesCount(long value);

  /**
   * Sets the last access date.
   * @param value the date
   */
  void setLastAccessDate(DateTime value);

  /**
   * Sets the last IP address.
   * @param value the address
   */
  void setLastIP(String value);

  /**
   * Sets the first name.
   * @param value the value
   */
  void setLoginName(String value);

  /**
   * Sets the user.
   * @param value the new user
   */
  void setUser(IUser value);
}
